home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_06_05 / v6n5039a.txt < prev    next >
Text File  |  1989-09-26  |  2KB  |  27 lines

  1.  
  2. ╔═════════════════════════════════════════════════════════════════════════════╗
  3. ║                                                                             ║
  4. ║            Fig. 2 LALR Error Recovery on a POPL program                     ║
  5. ║                                                                             ║
  6. ║    Parsing ...                                                              ║
  7. ║    1       INT avg(INT a[10], INT count)                                    ║
  8. ║    2       {                                                                ║
  9. ║    3          INT indx, sum;        #local variables#                       ║
  10. ║    4                                                                        ║
  11. ║    5          indx = 0;                                                     ║
  12. ║    ----------------^ replacing with :=                                      ║
  13. ║    6          sum := 0;                                                     ║
  14. ║    7          WHILE indx < count DO {                                       ║
  15. ║    8             sum := sum + a[indx];                                      ║
  16. ║    9             indx := indx + 1;                                          ║
  17. ║    10            }                                                          ║
  18. ║    11         sum := sum  ) / count;                                        ║
  19. ║    -----------------------^ ignoring )                                      ║
  20. ║    12         RETURN sum;                                                   ║
  21. ║    13                                                                       ║
  22. ║    14                                                                       ║
  23. ║    --------^ inserting }                                                    ║
  24. ║    3 warnings, 14 lines, 0.11 sec.                                          ║
  25. ║                                                                             ║
  26. ╚═════════════════════════════════════════════════════════════════════════════╝
  27.